package com.handycraftz.site.client.presenter;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.MouseEvent;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.event.dom.client.MouseOverEvent;
import com.google.gwt.event.dom.client.MouseOverHandler;
import com.google.gwt.event.logical.shared.AttachEvent;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.MouseListener;
import com.google.gwt.user.client.ui.MouseListenerAdapter;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.handycraftz.site.client.event.HandyCraftzEvent;
import com.handycraftz.site.client.rpc.HandyCraftzService;
import com.handycraftz.site.client.rpc.HandyCraftzServiceAsync;
import com.handycraftz.site.client.ui.LayoutView;
import com.handycraftz.site.shared.util.HandyCraftzConstants;

public class LayoutPresenter extends Presenter {

	HandyCraftzServiceAsync rpcService;
	LayoutView view;

	public LayoutPresenter(HandlerManager eventBus) {
		super(eventBus);
		this.view = new LayoutView();
		this.rpcService = GWT.create(HandyCraftzService.class);
	}

	@Override
	public void go(HasWidgets container) {
		bindEventHandlers();
		container.clear();
		container.add(view.asWidget());
	}

	private void bindEventHandlers() {

		//adding hover handlers
		  addHoverEffect();
		
		
		// To Centralize in Multiple Resolutions
		view.getDivWrapper().addAttachHandler(new AttachEvent.Handler() {
			@Override
			public void onAttachOrDetach(AttachEvent event) {
				Double leftCalc = (double) ((Window.getClientWidth() - 900)) / 2;
				view.getDivInner().getElement().getStyle()
						.setLeft(leftCalc, Unit.PX);
			}
		});

		//Initialize home slider
		  view.getDivCarousel().addAttachHandler(new AttachEvent.Handler() {
			
			@Override
			public void onAttachOrDetach(AttachEvent event) {
				
				DOM.setElementAttribute(view.getDivSliderNameNavigation().getElement(), "id", "SliderNameNavigation");
				DOM.setElementAttribute(view.getDivSliderName().getElement(), "id", "SliderName");
				//startSlider();
			}

		});
		
		
		  
		// Home Navigation
		view.getDivHomeNav().addDomHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				eventBus.fireEvent(new HandyCraftzEvent(
						HandyCraftzConstants.HANDYCRAFTZ_TOKEN_LAYOUT));
			}
		}, ClickEvent.getType());

	
		view.getDivHomeFooter().addDomHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				eventBus.fireEvent(new HandyCraftzEvent(
						HandyCraftzConstants.HANDYCRAFTZ_TOKEN_LAYOUT));
			}
		}, ClickEvent.getType());

		// About Us Navigation
		view.getDivAboutNav().addDomHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				eventBus.fireEvent(new HandyCraftzEvent(
						HandyCraftzConstants.HANDYCRAFTZ_TOKEN_ABOUT_US));
				navigateToAboutUs();
			}
		}, ClickEvent.getType());

		view.getDivAboutFooter().addDomHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				eventBus.fireEvent(new HandyCraftzEvent(
						HandyCraftzConstants.HANDYCRAFTZ_TOKEN_ABOUT_US));
				navigateToAboutUs();
			}
		}, ClickEvent.getType());

		// Product navigation

		view.getDivProductNav().addDomHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {

				eventBus.fireEvent(new HandyCraftzEvent(
						HandyCraftzConstants.HANDYCRAFTZ_TOKEN_PRODUCTS));
				navigateToProducts();
			}
		}, ClickEvent.getType());

		view.getDivProductFooter().addDomHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				eventBus.fireEvent(new HandyCraftzEvent(
						HandyCraftzConstants.HANDYCRAFTZ_TOKEN_PRODUCTS));
				navigateToProducts();
			}
		}, ClickEvent.getType());

		// join us navigation
		view.getDivJoinNav().addDomHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				eventBus.fireEvent(new HandyCraftzEvent(
						HandyCraftzConstants.HANDYCRAFTZ_TOKEN_JOIN_US));
				navigateToJoin();
			}

		}, ClickEvent.getType());

		view.getDivJoinFooter().addDomHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				eventBus.fireEvent(new HandyCraftzEvent(
						HandyCraftzConstants.HANDYCRAFTZ_TOKEN_JOIN_US));
				navigateToJoin();
			}
		}, ClickEvent.getType());

		// Facebook and twitter navigation

		view.getImgFaceBook().addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				redirect(HandyCraftzConstants.HANDYCRAFTZ_SOCIAL_FACEBOOK_URL);
			}
		});

		view.getImgTwitter().addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				redirect(HandyCraftzConstants.HANDYCRAFTZ_SOCIAL_TWITTER_URL);

			}
		});

		// Contacts Navigation

		view.getDivContactNav().addDomHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				eventBus.fireEvent(new HandyCraftzEvent(
						HandyCraftzConstants.HANDYCRAFTZ_TOKEN_CONTACT_US));
				navigateToContactUs();
			}
		}, ClickEvent.getType());

		view.getDivContactFooter().addDomHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				eventBus.fireEvent(new HandyCraftzEvent(
						HandyCraftzConstants.HANDYCRAFTZ_TOKEN_CONTACT_US));
				navigateToContactUs();
			}
		}, ClickEvent.getType());

	}

	private void addHoverEffect() {
		
		
       view.getDivHomeNav().addDomHandler(new MouseOverHandler() {
			
			@Override
			public void onMouseOver(MouseOverEvent event) {
				view.getDivHomeNav().setStyleName("homeNavigationHover");
			}
		},MouseOverEvent.getType());
		
	   
       view.getDivHomeNav().addDomHandler(new MouseOutHandler() {
			
			@Override
			public void onMouseOut(MouseOutEvent event) {
				view.getDivHomeNav().setStyleName("homeNavigation");
			}
		},MouseOutEvent.getType());
       
       
       
       view.getDivAboutNav().addDomHandler(new MouseOverHandler() {
			
			@Override
			public void onMouseOver(MouseOverEvent event) {
				view.getDivAboutNav().setStyleName("aboutNavigationHover");
			}
		},MouseOverEvent.getType());
		
	   
      view.getDivAboutNav().addDomHandler(new MouseOutHandler() {
			
			@Override
			public void onMouseOut(MouseOutEvent event) {
				view.getDivAboutNav().setStyleName("aboutNavigation");
			}
		},MouseOutEvent.getType());
      
      
      
      
      view.getDivProductNav().addDomHandler(new MouseOverHandler() {
			
			@Override
			public void onMouseOver(MouseOverEvent event) {
				view.getDivProductNav().setStyleName("productNavigationHover");
			}
		},MouseOverEvent.getType());
		
	   
     view.getDivProductNav().addDomHandler(new MouseOutHandler() {
			
			@Override
			public void onMouseOut(MouseOutEvent event) {
				view.getDivProductNav().setStyleName("productNavigation");
			}
		},MouseOutEvent.getType());
     
     
     
     view.getDivJoinNav().addDomHandler(new MouseOverHandler() {
			
			@Override
			public void onMouseOver(MouseOverEvent event) {
				view.getDivJoinNav().setStyleName("joinNavigationHover");
			}
		},MouseOverEvent.getType());
		
	   
    view.getDivJoinNav().addDomHandler(new MouseOutHandler() {
			
			@Override
			public void onMouseOut(MouseOutEvent event) {
				view.getDivJoinNav().setStyleName("joinNavigation");
			}
		},MouseOutEvent.getType());
    
    
    
    view.getDivContactNav().addDomHandler(new MouseOverHandler() {
		
		@Override
		public void onMouseOver(MouseOverEvent event) {
			view.getDivContactNav().setStyleName("contactNavigationHover");
		}
	},MouseOverEvent.getType());
	
   
    view.getDivContactNav().addDomHandler(new MouseOutHandler() {
		
		@Override
		public void onMouseOut(MouseOutEvent event) {
			view.getDivContactNav().setStyleName("contactNavigation");
		}
	},MouseOutEvent.getType());
   
    
    
    view.getDivBlogNav().addDomHandler(new MouseOverHandler() {
		
		@Override
		public void onMouseOver(MouseOverEvent event) {
			view.getDivBlogNav().setStyleName("blogNavigationHover");
		}
	},MouseOverEvent.getType());
	
  
    view.getDivBlogNav().addDomHandler(new MouseOutHandler() {
		
		@Override
		public void onMouseOut(MouseOutEvent event) {
			view.getDivBlogNav().setStyleName("blogNavigation");
		}
	},MouseOutEvent.getType());
		
		
	}

	public LayoutView getView() {
		return view;
	}

	private void navigateToProducts() {

		view.getDivContentBar().clear();
		Image product = new Image("images/productsCarousel.png");
		product.setStyleName("productsCarousel");

		Image productLeftArrow = new Image("images/productLeft.png");
		productLeftArrow.setStyleName("productLeftArrow");

		Image productRightArrow = new Image("images/productRight.png");
		productRightArrow.setStyleName("productRightArrow");

		Label productName = new Label("Products name");
		productName.setStyleName("productName");
		Label productDesc = new Label("Description will comes here");
		productDesc.setStyleName("productDesc");

		HTMLPanel outer = new HTMLPanel("");
		HTMLPanel inner = new HTMLPanel("");

		inner.setStyleName("productInnerBorder");
		outer.setStyleName("productOuterBorder");

		outer.add(inner);
		outer.add(product);
		outer.add(productLeftArrow);
		outer.add(productRightArrow);
		outer.add(productName);
		outer.add(productDesc);

		view.getDivContentBar().add(outer);
	}

	public void navigateToAboutUs() {
		// Removing Everything from the Content Loader
		view.getDivContentBar().clear();
		// Creating New Instances for Each new Widget
		HTMLPanel storyOuter = new HTMLPanel("");
		HTMLPanel storyInner = new HTMLPanel("");
		HTMLPanel teamImageOuter = new HTMLPanel("");
		HTMLPanel teamImageInner = new HTMLPanel("");
		HTMLPanel productsPanel = new HTMLPanel("");
		HTMLPanel socialNetworkPanel = new HTMLPanel("");
		HTMLPanel googleAdPanel = new HTMLPanel("");
		// Creating Images for the Divisions
		Image googleImage = new Image("images/adsByGoogle.png");
		Image productImage = new Image("images/homeProduct.png");
		Image facebookImage = new Image("images/facebook.png");
		Image twitterImage = new Image("images/twitter.png");
		// Adding Styles To Images
		productImage.setStyleName("imgHomeProduct");
		facebookImage.setStyleName("imgFaceBook");
		twitterImage.setStyleName("imgTwiiter");
		googleImage.setStyleName("imgAddByGoogle");
		// Changing CSS Classes to About Page Standard
		storyInner.setStyleName("aboutStoryInner");
		storyOuter.setStyleName("aboutStoryOuter");
		productsPanel.setStyleName("aboutRightProducts");
		socialNetworkPanel.setStyleName("aboutSocialNetwork");
		googleAdPanel.setStyleName("aboutDivGoogleAdd");
		teamImageOuter.setStyleName("aboutFromBlogOuter");
		teamImageInner.setStyleName("aboutFromBlogInner");
		teamImageInner.getElement().setInnerHTML("<img src='images/teamImage.png' height='304px' width='485px'/>");
		// Adding Inner Elements to Outer Divisions
		storyOuter.add(storyInner);
		teamImageOuter.add(teamImageInner);
		googleAdPanel.add(googleImage);
		productsPanel.add(productImage);
		socialNetworkPanel.add(facebookImage);
		socialNetworkPanel.add(twitterImage);
		// Replacing The Top Most Box Inner Content
		storyInner
				.getElement()
				.setInnerHTML(
						"<p><h2>Our Story</h2></p>"
								+ "<p>The dream child of 3 enterprising women who decided, "
								+ "to be the change they want to see in the world! </p> "
								+ "<p><b>Shahnaz Tahir</b> and <b>Soli Somanath</b> software engineers by profession "
								+ "and a philantropists by passion.</p> <p>Both of them met while volunteering "
								+ "for <b>Make A Difference </b>(MAD). During the time they spent with the kids "
								+ "of their centre, they came to organise a craft session for the kids "
								+ "they taught. The session was conducted by none other than the renowned "
								+ "designer <b>Lakshmi Menon</b>.</p>  <p>With her simple techniques and using waste, "
								+ "She taught the kids to designed cards, pouches and what not, all in a matter "
								+ "of a few hours.The quality of the products were in par with the likes sold "
								+ "in high end boutiques!</p> <p>They decided to show these products to some high end "
								+ "stores in Cochin downtown. The response they got was so morale boosting that "
								+ "they thought..why not?!!</p> <p><b>Why not do something for the underpriveleged in the "
								+ "society?</p><p>  Wht not train them in making wealth from waste?  </p><p>Why not make them "
								+ "self sustainable?  </p><p>Why not help them realsie their dreams?  </p><p>Why not help them "
								+ "channel their efforts towards a good cause?</b>   </p><p>Their thought didnt stay as complex"
								+ " dreams filled withwhy nots, what ifs and how shalls. they worked on it together."
								+ " Met like minded people Dipa, Sreeni, Anupama and together they gave that breath"
								+ " of life to Handycraftz India.  </p><p><h3>Adding colors to life! </h3></p>");
		// Adding Each of the Widgets to the Page
		view.getDivContentBar().add(storyOuter);
		view.getDivContentBar().add(teamImageOuter);
		view.getDivContentBar().add(productsPanel);
		view.getDivContentBar().add(socialNetworkPanel);
		view.getDivContentBar().add(googleAdPanel);

		// Facebook and twitter navigation

		facebookImage.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				redirect(HandyCraftzConstants.HANDYCRAFTZ_SOCIAL_FACEBOOK_URL);
			}
		});

		twitterImage.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				redirect(HandyCraftzConstants.HANDYCRAFTZ_SOCIAL_TWITTER_URL);

			}
		});

	}

	public void navigateToContactUs() {

		final Image loadingImage = new Image("images/loadData.gif");
		
		// Removing Everything from the Content Loader
		view.getDivContentBar().clear();

		// Creating New Instances for Each new Widget
		HTMLPanel storyOuter = new HTMLPanel("");
		HTMLPanel storyInner = new HTMLPanel("");
		HTMLPanel productsPanel = new HTMLPanel("");
		HTMLPanel socialNetworkPanel = new HTMLPanel("");
		HTMLPanel googleAdPanel = new HTMLPanel("");

		// Creating Images for the Divisions
		Image googleImage = new Image("images/adsByGoogle.png");
		Image productImage = new Image("images/homeProduct.png");
		Image facebookImage = new Image("images/facebook.png");
		Image twitterImage = new Image("images/twitter.png");

		// Adding Styles To Images
		productImage.setStyleName("imgHomeProduct");
		facebookImage.setStyleName("imgFaceBook");
		twitterImage.setStyleName("imgTwiiter");
		googleImage.setStyleName("imgAddByGoogle");

		// Changing CSS Classes to About Page Standard
		storyInner.setStyleName("contactStoryInner");
		storyOuter.setStyleName("contactStoryOuter");
		productsPanel.setStyleName("aboutRightProducts");
		socialNetworkPanel.setStyleName("aboutSocialNetwork");
		googleAdPanel.setStyleName("aboutDivGoogleAdd");

		// Adding Inner Elements to Outer Divisions
		storyOuter.add(storyInner);
		googleAdPanel.add(googleImage);
		productsPanel.add(productImage);
		socialNetworkPanel.add(facebookImage);
		socialNetworkPanel.add(twitterImage);

		// Adding Each of the Widgets to the Page
		view.getDivContentBar().add(storyOuter);
		view.getDivContentBar().add(productsPanel);
		view.getDivContentBar().add(socialNetworkPanel);
		view.getDivContentBar().add(googleAdPanel);

		Label contactUsLabel = new Label("Contact Us");

		Label mailerNameLabel = new Label("Your Name (required)");
		final TextBox mailerName = new TextBox();
		Label mailerEmailLabel = new Label("Your Email (required)");
		final TextBox mailerEmail = new TextBox();
		Label mailerSubjectLabel = new Label("Subject");
		final TextBox mailerSubject = new TextBox();
		Label mailerContentLabel = new Label("Your Message");
		final TextArea mailerContent = new TextArea();
		Button submitMail = new Button("Send");
		final Label statusLabel = new Label("");

		final FlexTable contactTable = new FlexTable();

		contactTable.setStyleName("contactsTable");
		mailerName.setStyleName("mailerTextBox");
		mailerEmail.setStyleName("mailerTextBox");
		mailerSubject.setStyleName("mailerTextBox");
		mailerContent.setStyleName("mailerTextArea");
		submitMail.setStyleName("mailerSubmitButton");
		contactUsLabel.setStyleName("contactUsLabel");

		contactTable.setWidget(0, 0, mailerNameLabel);
		contactTable.setWidget(1, 0, mailerName);
		contactTable.setWidget(2, 0, mailerEmailLabel);
		contactTable.setWidget(3, 0, mailerEmail);
		contactTable.setWidget(4, 0, mailerSubjectLabel);
		contactTable.setWidget(5, 0, mailerSubject);
		contactTable.setWidget(6, 0, mailerContentLabel);
		contactTable.setWidget(7, 0, mailerContent);
		contactTable.setWidget(8, 0, submitMail);
		

		storyInner.add(contactUsLabel);
		storyInner.add(contactTable);

		submitMail.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				contactTable.remove(statusLabel);
				contactTable.setWidget(10,0, loadingImage);
				String name = mailerName.getText().trim();
				String emailId = mailerEmail.getText().trim();
				String subject = mailerSubject.getText().trim();
				String content = mailerContent.getText().trim();
				rpcService.contactWithMailerDaemon(name, subject, content, emailId,
						HandyCraftzConstants.HANDYCRAFTZ_MAILER_SUPPORT_ID,
						new AsyncCallback<String>() {
							@Override
							public void onSuccess(String result) {
								contactTable.remove(loadingImage);
								contactTable.setWidget(9, 0, statusLabel);
								if(result.startsWith("e"))
								{									
									statusLabel.setStyleName("error");	
								}
								else if(result.startsWith("s"))
								{
									statusLabel.setStyleName("success");
								}
								result = result.substring(result.indexOf(":") + 1, result.length());
								statusLabel.setText(result);
							}
							@Override
							public void onFailure(Throwable caught) {
								contactTable.setWidget(9, 0, statusLabel);
								statusLabel.setText("Cannot Contact HandyCraftz Server, Please Try Again...");
								statusLabel.setStyleName("error");
								contactTable.remove(loadingImage);
							}
						});
			}
		});

		// Facebook and twitter navigation

		facebookImage.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				redirect(HandyCraftzConstants.HANDYCRAFTZ_SOCIAL_FACEBOOK_URL);
			}
		});

		twitterImage.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				redirect(HandyCraftzConstants.HANDYCRAFTZ_SOCIAL_TWITTER_URL);

			}
		});
	}

	private void navigateToJoin() {

		view.getDivContentBar().clear();

		HTMLPanel storyOuter = new HTMLPanel("");
		HTMLPanel storyInner = new HTMLPanel("");
		HTMLPanel productsPanel = new HTMLPanel("");
		HTMLPanel socialNetworkPanel = new HTMLPanel("");
		HTMLPanel googleAdPanel = new HTMLPanel("");
		HTMLPanel joinUspanel = new HTMLPanel("");
		HTMLPanel grouper = new HTMLPanel("");

		Label joinUs = new Label("Join Us");
		Label name = new Label("Name:");
		Label email = new Label("Email:");
		Label phone = new Label("Phone:");
		Label city = new Label("City:");

		TextBox txtName = new TextBox();
		TextBox txtEmail = new TextBox();
		TextBox txtPhone = new TextBox();

		ListBox listCity = new ListBox();
		listCity.insertItem("Cochin", 0);

		Image registerBTN = new Image("images/register.png");

		// Changing CSS Classes to About Page Standard

		Image googleImage = new Image("images/adsByGoogle.png");
		Image productImage = new Image("images/homeProduct.png");
		Image facebookImage = new Image("images/facebook.png");
		Image twitterImage = new Image("images/twitter.png");

		joinUs.setStyleName("joinUsLabel");
		productImage.setStyleName("imgHomeProduct");
		facebookImage.setStyleName("imgFaceBook");
		twitterImage.setStyleName("imgTwiiter");
		googleImage.setStyleName("imgAddByGoogle");

		storyInner.setStyleName("joinFormInner");
		storyOuter.setStyleName("joinFormOuter");
		productsPanel.setStyleName("aboutRightProducts");
		socialNetworkPanel.setStyleName("aboutSocialNetwork");
		googleAdPanel.setStyleName("aboutDivGoogleAdd");
		joinUspanel.setStyleName("joinFormPanel");

		name.setStyleName("joinNameLabel");
		email.setStyleName("joinEmailLabel");
		phone.setStyleName("joinPhoneLabel");
		city.setStyleName("joinCityLabel");
		listCity.setStyleName("joinCityListBox");
		txtName.setStyleName("joinNameTxt");
		txtEmail.setStyleName("joinEmailTxt");
		txtPhone.setStyleName("joinPhoneTxt");
		registerBTN.setStyleName("joinRegBTN");
		grouper.setStyleName("grouper");

		googleAdPanel.add(googleImage);
		productsPanel.add(productImage);
		socialNetworkPanel.add(facebookImage);
		socialNetworkPanel.add(twitterImage);

		grouper.add(name);
		grouper.add(email);
		grouper.add(phone);
		grouper.add(city);
		grouper.add(txtName);
		grouper.add(txtEmail);
		grouper.add(txtPhone);
		grouper.add(listCity);
		grouper.add(registerBTN);

		joinUspanel.add(grouper);
		storyInner.add(joinUspanel);
		storyOuter.add(storyInner);

		view.getDivContentBar().add(joinUs);
		view.getDivContentBar().add(storyOuter);
		view.getDivContentBar().add(productsPanel);
		view.getDivContentBar().add(socialNetworkPanel);
		view.getDivContentBar().add(googleAdPanel);

		// Facebook and twitter navigation

		facebookImage.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				redirect(HandyCraftzConstants.HANDYCRAFTZ_SOCIAL_FACEBOOK_URL);
			}
		});

		twitterImage.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				redirect(HandyCraftzConstants.HANDYCRAFTZ_SOCIAL_TWITTER_URL);
			}
		});
	}

	// redirect the browser to the given url
	public static native void redirect(String url)/*-{
		$wnd.open(url);
	}-*/;

	public static native void startSlider()/*-{
        var demoSlider = $wnd.Sliderman.slider({container: 'SliderName', width: 900, height: 360, effects: '',
            display: {
                pause: true, // slider pauses on mouseover
                autoplay: 3000, // 3 seconds slideshow
                always_show_loading: 200, // testing loading mode
                description: { }, // image description box settings
                loading: {}, // loading box settings
                buttons: {opacity: 1, prev: {className: 'SliderNamePrev', label: ''}, next: {className: 'SliderNameNext', label: ''}}, // Next/Prev buttons settings
                navigation: {container: 'SliderNameNavigation', label: '&nbsp;'} // navigation (pages) settings
            }});
	}-*/;
	
}
